/**	
 * <br>
 * Copyright 2011 Chuan. All rights reserved.<br>
 * <br>			 
 * Package: com.chuan.mantu.sql <br>
 * FileName: DBHelper.java <br>
 * <br>
 * @version
 * @author javacyc@qq.com
 * @created 2013-1-18
 * @last Modified 
 * @history
 */

package com.chuan.mantu.sql;

import com.chuan.mantu.utils.Const;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

/**
 * {创建本地数据库}
 *  
 *  @author javacyc@qq.com
 *  @created 2013-1-18 下午03:06:25
 *  @lastModified       
 *  @history           
 */

public class DBHelper extends SQLiteOpenHelper {

    private static final String DATABASE_NAME = "mantu.db";
    
    private static final int DATABASE_VERSION = 1;
    
	public DBHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	//版本改变时会调用此方法
	@Override
	public void onCreate(SQLiteDatabase db) {
		Log.d(Const.DEBUG, "create a database");
		db.execSQL("CREATE TABLE IF NOT EXISTS config (name VARCHAR, value VARCHAR)");
		db.execSQL("INSERT INTO config VALUES('"+Const.CONFIG_INTENET_MOBILE+"', '0')");
	}

	//如果发现DATABASE_VERSION被改变则调用此方法,扯淡吧,onCreate也被调用了
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	}

}